function [negLL,LL] = dreumLL2_calculate2(alpha,choiceFull,ppFull,tcidx,phi,P,pi,tau,K,zeta)

% Calculate log-likelihood for each individual-----------------------------
obs = size(choiceFull(:,:,1),1); % Define number of observations
LL = zeros(obs,1); % Initialize vector of log-likelihoods

for idx1 = 1:obs
    
    % Collect choice and travel cost data for each observation
    tcCombo = tcidx(idx1);
    prefPts08 = ppFull{1}(idx1) + 1;
    prefPts09 = min(ppFull{2}(idx1) + 1,K);
    hunt08 = choiceFull(idx1,1) + 1;
    hunt09 = choiceFull(idx1,2) + 1;
    phi08 = phi(hunt08,prefPts08);
    if prefPts09 == 1 && hunt08 < 24
        G = phi08;
    elseif hunt08 == 24
        G = 1;
    elseif prefPts09 > 1 && hunt08 < 24
        G = (1 - phi08);
    end

        
    P1 = zeros(1,tau);
    P2 = P1;
    P3 = P1;
    for idx2 = 1:tau
        
        P09 = P(hunt09,prefPts09,tcCombo,idx2);
        P08 = P(hunt08,prefPts08,tcCombo,idx2);
        zeta08 = zeta(prefPts08,1,tcCombo,idx2);
        
        % P(j',p',a' = 1,j,p,a = 1 | a' + a > 0)
        P1(idx2) = P09*G*(1 - alpha)*P08*zeta08*1/(1 + alpha)*pi(idx2);
        
        % P(j',p',a' = 0,j,p,a = 1 | a' + a > 0)
        P2(idx2) = alpha*P08*zeta08*1/(1 + alpha)*pi(idx2);
        
        % P(j',p',a' = 1,j,p,a = 0 | a' + a > 0)
        P3(idx2) = P09*alpha/(1 + alpha)*pi(idx2);            
       
    end
    
    LL(idx1) = log(sum(P1) + (hunt09==24)*sum(P2) + (hunt08==24&prefPts09==1)*sum(P3));    
    
end

negLL = -sum(LL);